<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="css/style1.css" rel="stylesheet" type="text/css" />
<link href="css/select.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.idTabs.min.js"></script>
<script type="text/javascript" src="js/select-ui.min.js"></script>
<script type="text/javascript" src="editor/kindeditor.js"></script>

<script type="text/javascript">
    KE.show({
        id : 'content7',
        cssPath : './index.css'
    });
  </script>
  
<script type="text/javascript">
$(document).ready(function(e) {
    $(".select1").uedSelect({
		width : 345			  
	});
	$(".select2").uedSelect({
		width : 167  
	});
	$(".select3").uedSelect({
		width : 100
	});
});

$(function(){

	$("#selected1").change(function(){
	
		var astatus=$(this).val();
		if(astatus=="全部"){
			window.location="/admin-articleinfo?astatus=all";
		}else if(astatus=="已审核"){
			window.location="/admin-articleinfo?astatus=yes";
		}else{
			window.location="/admin-articleinfo?astatus=no";
		}
		
	});
	
	$("#search").click(function(){
		var search=$("#searchInput").val();
		console.log(search);
		window.location="/admin-articleinfo?atitle="+search;
	});
	
	
	
});

</script>
</head>

<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">首页</a></li>
    <li><a href="#">征文信息</a></li>
    </ul>
    </div>
    
    <div class="formbody">
    
    
    <div id="usual1" class="usual"> 
    
    <div class="itab">
  	<ul> 
    <li><a href="#tab2" class="selected">文章信息管理</a></li> 
  	</ul>
    </div> 
    
  	<div id="tab2" class="tabson">
    
    
    <ul class="seachform">
    
    <li><label>综合查询</label><input id="searchInput" type="text" class="scinput" /></li>
    <li><label>&nbsp;</label><input id="search" type="button" class="scbtn" value="查询"/></li>
    
    <li><label>文章状态</label>  
    <div class="vocation">
    <select class="select3" id="selected1">
    <option>--------</option>
    <option>全部</option>
    <option>已审核</option>
    <option>未审核</option>
    </select>
    </div>
    </li>
    
    
    </ul>
    
    
    <table class="tablelist">
    	<thead>
    	<tr>
        <th><input name="" type="checkbox" value="" checked="checked"/></th>
        <th>编号<i class="sort"><img src="images/px.gif" /></i></th>
        <th>标题</th>
        <th>用户</th>
        <th>分数</th>
        <th>发布时间</th>
        <th>是否审核</th>
        <th>操作</th>
        </tr>
        </thead>
        <script type="text/javascript">
        	function deleteArticle(){
				var a=confirm("确认删除吗？");
				console.log(a);
				if(a===true){
					return true;
				}
				return false;
				
			}
        	
        </script>
        <tbody>
        	<c:forEach items="${articleList }" var="article">
		        <tr>
		        <td><input name="" type="checkbox" value="" /></td>
		        <td>${article.aid }</td>
		        <td>${article.atitle }</td>
		        <td>${article.user.uname }</td>
		        <td>${article.ascore }</td>
		        <td><fmt:formatDate value='${article.acreatetime }' pattern='yyyy-MM-dd HH:mm:ss'/></td>
		        <td>
		        	<c:if test="${article.astatus==true }">已审核</c:if>
		        	<c:if test="${article.astatus==false }"><span style="color: red;">未审核</span></c:if>
		        </td>
		        <td><a href="/admin-view?aid=${article.aid }" class="tablelink">查看</a>     <a href="deleteArtilceByaAid/${article.aid }"  onclick="return deleteArticle()" class="tablelink"> 删除</a></td>
		        </tr> 
	        </c:forEach>
        </tbody>
    </table>
     <div class="pagin">
    	<div class="message">共<i class="blue">${page.total }</i>条记录，当前显示第&nbsp;<i class="blue">${page.pageNum }&nbsp;</i>页</div>
        <ul class="paginList">
	        <li class="paginItem"><span class="pagepre">
	        	<c:if test="${page.pageNum-1>0 }"><a href="/admin-articleinfo?pageNum=${page.pageNum-1 }&astatus=${astatus}&atitle=${atitle}"></span></a></c:if>
	        	<c:if test="${page.pageNum-1<=0}"><a href="javascript:;"></span></a></c:if>	
	        </li>
	        <c:if test="${page.pageNum-3>=0 }"><li class="paginItem"><a href="/admin-articleinfo?astatus=${astatus }&atitle=${atitle}">1</a></li></c:if>
	        <c:if test="${page.pageNum-3>0 }"><li class="paginItem"><a href="javascript:;">...</a></li></c:if>
	        <c:if test="${page.pageNum-1>0 }"><li class="paginItem"><a href="/admin-articleinfo?pageNum=${page.pageNum-1 }&astatus=${astatus}&atitle=${atitle}">${page.pageNum-1 }</a></li></c:if>
	        <li class="paginItem current"><a href="javascript:;">${page.pageNum }</a></li>
	        <c:if test="${page.pageNum+1<=page.pages }"><li class="paginItem"><a href="/admin-articleinfo?pageNum=${page.pageNum+1 }&astatus=${astatus}&atitle=${atitle}">${page.pageNum+1 }</a></li></c:if>
	        <c:if test="${page.pageNum+2<page.pages }"><li class="paginItem"><a href="javascript:;">...</a></li></c:if>
	        <c:if test="${page.pageNum+2<=page.pages }"><li class="paginItem"><a href="/admin-articleinfo?pageNum=${page.pages }&astatus=${astatus}&atitle=${atitle}">${page.pages }</a></li></c:if>
	        <li class="paginItem"><span class="pagenxt">
	        	<c:if test="${page.pageNum<page.pages }"><a href="/admin-articleinfo?pageNum=${page.pageNum+1 }&astatus=${astatus}&atitle=${atitle}"></span></a></c:if>
	        	<c:if test="${page.pageNum>=page.pages}"><a href="javascript:;"></span></a></c:if>	
	        </li>
        </ul>
    </div>
   
  
    
    </div>  
       
	</div> 
 
	<script type="text/javascript"> 
      $("#usual1 ul").idTabs(); 
    </script>
    
    <script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');
	</script>
    
    
    
    </div>

</body>
</html>
